﻿using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;

namespace LinqTest
{
    class Program
    {
        private static Dictionary<string, WorkStation> m_WorkStation = null;

        public static char[] ConvertToBinary(ulong flag, int count)
        {
            char[] result = new char[count];
            string str = Convert.ToString((long)flag, 2);
            if (str.Length < count)
            {
                str = str.PadLeft(count, '0');
            }

            char[] ch = str.ToArray();
            if (ch.Length > count)
            {
                for (int i = 0; i < count; i++)
                {
                    result[i] = ch[i];
                }
            }
            else
            {
                result = ch;
            }
            Array.Reverse(result);
            return result;
        }



        static void Main(string[] args)
        {





            var bbbbb = Convert.ToInt64(0.333);

            var kk = DateTime.Now;

            // char[] ch = ConvertToBinary(1024, 24);

            Dictionary<string, string> dict = new Dictionary<string, string>();
            dict.Add("修吾", "长剑");
            dict.Add("月清疏", "轻剑");
            dict.Add("白茉晴", "灵符");
            dict.Add("桑游", "弓弩");

            foreach (var key in dict.Keys)
            {

            }

            var kkk = (from val in dict select val.Key);

            object[] secNames = (from val in dict select val.Key).ToArray<object>();

            object[] secNames2 = (from val in dict select val.Key).ToArray();

            var secNames3 = (from val in dict select val.Key).ToList();

            var ll = dict.Keys.ToList();


            for (int a1 = 0; a1 < dict.Count; a1++)
            {
                var key = dict.Keys.ElementAt(a1);
                var source = dict[key];

            }

            for (int a2 = 0; a2 < dict.Count; a2++)
            {
                var aaaa444 = dict.Keys.First();

                var key = dict.Keys.ElementAt(a2);
                var val = dict.Values.ElementAt(a2);

            }

            for (int a2 = 0; a2 < dict.Values.Count; a2++)
            {
                var key = dict.Keys.ElementAt(a2);
                var val = dict.Values.ElementAt(a2);

            }


            foreach (var a3 in dict.ToArray())
            {
                var kk1 = a3.Key;
                var kk2 = a3.Value;
            }




            List<int> list = new List<int>();
            list.Add(11);
            list.Add(22);
            list.Add(33);
            list.Add(44);
            var last = list.Count > 0 ? list[list.Count - 1] : 0;

            var aaaa = list.Take(1).ToList();
            var bbbb = list.Skip(2).ToList();

            //  var ccc = list.Average();



            m_WorkStation = new Dictionary<string, WorkStation>();

            m_WorkStation.Add("A", new WorkStation() { BranchType = "AA" });
            m_WorkStation.Add("B", new WorkStation() { BranchType = "BB" });

            foreach (var aaa in m_WorkStation.ToArray())
            {
                var o = aaa.Key;
            }



            var a = m_WorkStation.Keys.ToList();
            var bbb = m_WorkStation.Keys.ToString();


            double[] yout = new double[3];
            //yout[0] = 10;
            //yout[1] = 100;
            //yout[2] = 1000;

            var bbb2 = yout.Count(i => i > 0);
            var b = yout.ToList();
        }



    }
}
